You could perform a SELECT on the database first to see if the value exists. If it does, have the code perform an UPDATE, otherwise, INSERT.
There is no single function which will determine this for you. You'll need to query the database and, based on the returned results, perform your action.
-Rich