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