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