UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uq39Wd8uGkuyYjBbosoSe2tSPQq8dXzIHtwBQxdcGBU='
WHERE
key_id = '01276f9ecfdeaa403a4b403219afb2b97eaf448ab3a116a548147b34edd7bb64'
AND (
token = 'uq39Wd8uGkuyYjBbosoSe2tSPQq8dXzIHtwBQxdcGBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)