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