UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TGdsrqM+oaYh7F8vL2NulUVZkUCVREY+K6ac9XAiLLs='
WHERE
key_id = 'c1c299ce8b19d10414fd2452428d37ee4e953a9e239d64c1a0784af7c32b79be'
AND (
token = 'TGdsrqM+oaYh7F8vL2NulUVZkUCVREY+K6ac9XAiLLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)