UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KqFBigMaYRNj0JsboT216L9H0Ap2M+uuu+0zSjf49qc='
WHERE
key_id = '4d8e9d132b38848239cfc03e560392a7b86113c5f6eb6ed9125ab557a2d66893'
AND (
token = 'KqFBigMaYRNj0JsboT216L9H0Ap2M+uuu+0zSjf49qc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)