UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qIXlbtAdHj+2OlCen6IVqF0JBwAxJ4+7bUTja2jkhks='
WHERE
key_id = 'f9be2188f1725ed3c807f5f654c649d45100390befddd9ef749df06c73f4594e'
AND (
token = 'qIXlbtAdHj+2OlCen6IVqF0JBwAxJ4+7bUTja2jkhks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)