UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ih6alnvoLvUUJCBvuMS5cD7rTBt7MQArE+MI2dnWT4='
WHERE
key_id = 'de1a5c3036aefe85e8a421b9c561b181c8c49f58625068215c72d16eb9fc9e55'
AND (
token = '0ih6alnvoLvUUJCBvuMS5cD7rTBt7MQArE+MI2dnWT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)