As Sergey K said, Have it check/connect to a server/database "sql" comes to mind. Have a sql table, Just for the keys alone. So every time someone uses a key, It will add it to that list then if someone trys and use the key the program will be like hey I see this key already no go. of course you will also need a system in play to have it so the actual user can reset it incase of lost key.
Another system no clue on how to do this to help with hacks that attach its self to a game, if you can figure it out if a program attach's its self to yours, the game will shut down and send a signal hey there trying to cheat the system .
Lots of ideas/ways to do anti cheat/hack systems.
All depends on the type of game you are trying to do and what is needed.
.:: Http://DeanWorks.Ca ::.
My software never has bugs. It just develops random features.