MySQL of version 4.1 and above has a nice new feature in the INSERT syntax [1]. You can build a query statement like:
INSERT INTO table (a,b,c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE c=c+1;
The command is quite self-explaining. It saves you some additional SELECT query magic before an INSERT statement.
[1] http://www.mysql.de/doc/en/INSERT.html