データの存在チェックを実施して、存在しない場合にinsert文を実行する
次のSQL文は、「select * from DB名.テーブル名 where col1='2013-12-31' and col2='3:00:00'」を実行した結果が存在しない場合に、「select *」を実行する。
select * from DB名.テーブル名 where not exists (select * from DB名.テーブル名 where col1='2013-12-31' and col2='3:00:00') limit 1;
これを応用すればよい。
insert into DB名.テーブル名 (colA,colB) select 'colAに入れる値','colBに入れる値' from DB名.テーブル名 from DB名.テーブル名 where col1='2013-12-31' and col2='3:00:00') limit 1;
ただし、col1とcol2はUNIQUEキーで無ければならない。
【参考ページ】
SQLでの条件付きInsert