UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zkXuWg7tW8iz89/FAlN8HwK5PJGIANkR+ogMZOL6Kt4='
WHERE
key_id = '5054a38a099c6b6f61e2fd0a74bca6016b449318ba963bc2a66d019abf7e0f2e'
AND (
token = 'zkXuWg7tW8iz89/FAlN8HwK5PJGIANkR+ogMZOL6Kt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)