UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PO5Z4dlVoO+kyK008zLCSzoOgsJqmlSseRh7aOUSx28='
WHERE
key_id = '241aaf0f9e6185459027ac795f804e8e7465ebc8845c995e854f314f293e56bb'
AND (
token = 'PO5Z4dlVoO+kyK008zLCSzoOgsJqmlSseRh7aOUSx28='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)