Maybe doing a SELECT and depending on the result doing an UPDATE or an INSERT ? Or just on checking if there is already an ID or not ?