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