主キーがなければINSERTしてあればUPDATE - INSERT ON DUPLICATE KEY UPDATE
CREATE TABLE t1 ( id1 int UNIQUE, id2 int) ;
INSERT INTO t1 ( id1, id2 ) VALUES ( 1, 100 ) ON DUPLICATE KEY UPDATE id1 = VALUES(id1);
+------+------+
| id1 | id2 |
+------+------+
| 1 | 100 |
+------+------+
INSERT INTO t1 ( id1, id2 ) VALUES ( 1, 101 ) ON DUPLICATE KEY UPDATE id1 = VALUES(id1);
+------+------+
| id1 | id2 |
+------+------+
| 1 | 100 |
+------+------+
INSERT INTO t1 ( id1, id2 ) VALUES ( 1, 101 ) ON DUPLICATE KEY UPDATE id2 = id2 + 1;
+------+------+
| id1 | id2 |
+------+------+
| 1 | 101 |
+------+------+