UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1iIUCkm8Rsf5jZEIIESUQbQEKLOsWe30onMQmilU1J8='
WHERE
key_id = 'f6287aff83b380ee86770c3c555456a817246521bc6ec52040b1f431eaf4c5c7'
AND (
token = '1iIUCkm8Rsf5jZEIIESUQbQEKLOsWe30onMQmilU1J8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)