UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PUOS/2OIjepa3UpRGOQXl9re7660bb/5hkPBmGez7R8='
WHERE
key_id = 'e5cbac3a3575fbcf46300a344b3a12b4e50125bd5b813a510819f966078812cf'
AND (
token = 'PUOS/2OIjepa3UpRGOQXl9re7660bb/5hkPBmGez7R8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)