I keep track of all the http_user_agents that visit me, with a simple hit counter.
The below insert the http_user_agent in the DB, this field is Case Insensitive and is Uniq
Unfortunately the solution is at the application level if you don't want to affect auto-increment id's. Do a SELECT first and count the result rows. If 0 results, INSERT the data. If more than 0, UPDATE that row.