UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f63Mdnl7bgC9wlegA1qkwil7NFth0jG8VW6bd5+KDeg='
WHERE
key_id = 'f2bc22c9912953012b9696d9805e19cbff638e32cd0768ed04141b06fc7a606f'
AND (
token = 'f63Mdnl7bgC9wlegA1qkwil7NFth0jG8VW6bd5+KDeg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)