MySQLは、insert-on-duplicate> 構文、例: INSERT INTO table (key,col1) VALUES (1,2) ON DUPLICATE KEY UPDATE col1 = 2;