`update -> affected rows = 0 -> insert` does not work well when the row did not change (two simultaneoes writes with same data). then the insert will create duplicate key again. it's also not safe against race conditions (mysql will throw a deadlock when using two such parallel transactions, same for delete -> insert though)
one could also catch exceptions on duplicate key and ingnore them. but it's not easily possible to do this correcly for all databases because each one has different subclasses of 23xxx sql state.