UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQrCfaQg74plRntdJjqJAUr/7zTHgEVctdWGh6lBIbU='
WHERE
key_id = 'd17df4fc0e94eae2fd3340763a35832a8980ba4d507b72ba7b71f07b52e26ff7'
AND (
token = 'tQrCfaQg74plRntdJjqJAUr/7zTHgEVctdWGh6lBIbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)