UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XOwJbHGVX+ZokCkiwENoB9jKGgoMm95+E4at9ikLhvQ='
WHERE
key_id = 'b98a806801902ea4b138e01a371142eb76038a8c7e9c96888e34cebdacd2cc49'
AND (
token = 'XOwJbHGVX+ZokCkiwENoB9jKGgoMm95+E4at9ikLhvQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)