Well, the easiest solution is to use LimeLM -- we handle everything releated to licenses making it easy for you to get paid. We even have an example script showing how to make an "allow updates for renewed users only" type script.
Looking over your script you have one very critical thing wrong:
$sql="SELECT * FROM Users WHERE Registration = '".$q."'";
Danger! This is very bad. All a malicious user needs to do is write a "q" GET parameter to get your entire database or, if they're feeling especially malicious, they can eliminate your entire database. You're not properly "quoting" the "q" variable. (Putting quotes around the $q is insufficient because a malicious user can write something like this for a "q" value:
' OR WHERE Registration != NULL; --
With this "q" value a user can get free updates.
To properly quote any user-touched information (like q) then use the mysql_real_escape_string function.
As far as sending the actual updates goes, we have an article (with some examples) showing how to deliver the update files after a license has been successfully verified. See: How to prevent or limit updates.