You can normally extract those from the old motherboards firmware and insert the data block into the new boards’ firmware. Otherwise you’d have to use Lenovos tools if you have access to them. Sometimes a Lenovo bios update asks if there’s a need to put in a new serial.
There’s a tool for decrypting the data block with this information (I never used it):