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