Not sure if it works on Windows 10, but in the past I've used a key finder program to find my old product keys.
https://www.magicaljellybean.com/keyfinder/
After you save your Windows 7 Key somewhere safe, you can still upgrade to Windows 10 from 7...