UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c4w5sGNSFTYoBW5XcCkMAsUz3rSaNnmpm+VUcrdfiP8='
WHERE
key_id = 'f8bda942432f11c09ca5ab84bb725f4f8fb920b411fc89e46449650ac49cfcbe'
AND (
token = 'c4w5sGNSFTYoBW5XcCkMAsUz3rSaNnmpm+VUcrdfiP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)