UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cqv/a1sXboJk7WihMsYUzWfWDF7NRM5assYhMC2S+4Y='
WHERE
key_id = '8ff5598592e09eef6ea438c757d4e679eb088ad5b049ec30f635a1ac8caa8eb4'
AND (
token = 'Cqv/a1sXboJk7WihMsYUzWfWDF7NRM5assYhMC2S+4Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)