UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DOnHq0szYzvAvxhtAIEZcYkHeewBvpOGZ6LvY9VOulU='
WHERE
key_id = '517be1bdd7dbcb4478fbc11c24ba22d3c7288634ac89c35d2c85803f99bbaed1'
AND (
token = 'DOnHq0szYzvAvxhtAIEZcYkHeewBvpOGZ6LvY9VOulU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)