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