UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'upjCe9newST6YMkjA/ry8NfYwEfWyhsmj/t53rovYqo='
WHERE
key_id = 'a1bcb2f3d1b41cb30ba9c6e037454aab1f563208d66be2cca7c2bc0dda3a903e'
AND (
token = 'upjCe9newST6YMkjA/ry8NfYwEfWyhsmj/t53rovYqo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)