UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xTYpYY0APBIFCtKU64NQ4bVoiC1pD4tiwrGms0o7Z5Y='
WHERE
key_id = 'cd86c2079d2b6da83d5d4a051077981b1e6d825f69653d4043a110fe36628636'
AND (
token = 'xTYpYY0APBIFCtKU64NQ4bVoiC1pD4tiwrGms0o7Z5Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)