UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Wh8QqamoFysNc0wQhUPZOKPndCK9GNkX0kJtA3waMdU='
WHERE
key_id = 'baba1a709ff5ca072ab164eee80381b41cc2354d992fe902e1a17e57d9645a2b'
AND (
token = 'Wh8QqamoFysNc0wQhUPZOKPndCK9GNkX0kJtA3waMdU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)