UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rIEAHLw8xJhCVMHjQrNhkK+Ir2K8WDhSnclLsUgqHw0='
WHERE
key_id = 'd51ce87e12d79042ad97c755e08bf45b24408a1c77ab75bb98e89c0e7a39ac92'
AND (
token = 'rIEAHLw8xJhCVMHjQrNhkK+Ir2K8WDhSnclLsUgqHw0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)