Check out mysql's EXIST and NOT EXIST clauses for update, insert, and select
and NOTFOUND for select:
This one will insert if it doesn't exist and update if it does. For what you want you can leave off the else statement, however, this is a good all purpose sql clause that will let you use one query to do several jobs.
Make sure that you have an id field that autoincrements.
Also, there are md5 hashing tools for javascript so that you can encrypt your password right out of the web form so that it doesn't go over the wire in plain text and both php and mysql have md5 functions. ALWAYS salt your md5!!!