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