It does not invalidate your Win7 key. That's impossible, with their current infrastructure anyway. You have 30 days to roll back from an upgrade before it deletes your backup, but your Windows 7 key will always work and you can just install it again if you wish.
As far as generating a key, I don't think you can. Microsoft gives you a notification for you to reserve your copy of Win 10, once you've done so Microsoft scans your system to make sure it's compatible (it is) and then prepares the perfect update for your system and downloads in the background. It will tell you when it's ready to install at your say so and you get your key then. That's how everyone is explaining it to me, anyway.