MySQLStateKeeper: handle Duplicate entry error correctly