You should use memcached for this since it is a single key (the IP address) storing a single value (the number of visits). You can use the atomic increment function to insure there are no "race" conditions.
It's faster than MySQL and saves the load so MySQL can focus on other things.
The current answer will only work in sqlite OR mysql (depending on if you use OR or not). So, if you want cross dbms compatibility, the following will do...
REPLACE INTO `visits` (ip, value) VALUES ($ip, 0);