Its all good, and you would remove the lines in the PHP that check if the key is valid, and in the query for registering where it says "WHERE key=$Key", take that out and make a variable for isRegistered, and just make it update a line where isRegistered=0
So instead of WHERE `key`='$Key', you would make a var called $isRegistered and make it 0, and then you would do WHERE `Registered`='$isRegistered'
Hopefully this helps a bit!
So before...
$result = $conn->query("SELECT * FROM users WHERE `key`='$Key'");
And after...
$result = $conn->query("SELECT * FROM users WHERE `0`='$isRegistered'");
or
$result = $conn->query("SELECT * FROM users WHERE `$isRegistered`='0'");