UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mj8Pqeq3E7w2UrqZkLcKBW5L1etMQcEoS4smoxi9G5k='
WHERE
key_id = 'e39c94efa3a4a9e73ce36ea35adc3827737bd419567321cd2480f9022814e90f'
AND (
token = 'Mj8Pqeq3E7w2UrqZkLcKBW5L1etMQcEoS4smoxi9G5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)