If you have installed SQL Server, you can do the following way to change the product key.
Opening SQL Server 2019 Installation Center. There may be a different name on your computer, you should select your respective sql server version.
You can also run setup.exe file, then select Maintenance link.

Clicking "Edition Upgrade"

Entering your product key, then click Next button.

Ticking on "I accept the license terms and Privacy Statement", then click Next button.

Clicking Next button.

Clicking Upgrade button.

Clicking Close button to finish.