UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'klFyymSjtT4QFPdNXuDwPiftHxOIJudA4h/WHYnpOSQ='
WHERE
key_id = 'c7bd46a66c02ff34dff1d4ac576403748710ab98da1056f801e4a7f9dc345f9b'
AND (
token = 'klFyymSjtT4QFPdNXuDwPiftHxOIJudA4h/WHYnpOSQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)