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