As long as you can find the actual license key sequence codes on your old PC, it may be used when UPgrading.
But not on a new Windows10 install.
This means you will have to install your old Win7 with license key on your new PC and THEN try upgrade to Windows10 on your new PC.
It is however much easier to purchase a new key. These days you get a digital key for cheap, but it is then bonded to the CPU in your PC, hence the key can not be migrated to another PC.
The factual windows 10 software is free to download and install, it has no key, and requires no key to install.
But you need a key to ACTIVATE your windows10 installed and be legal on your PC.