UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q9nfoN7diu0POKRlxU53uXX8f4vhRRDDFW/pntlH0pk='
WHERE
key_id = 'e8cc22f6ae1cf798172de38ec07ae98247791cf0095ac5ea236aa17a65f72c92'
AND (
token = 'Q9nfoN7diu0POKRlxU53uXX8f4vhRRDDFW/pntlH0pk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)