UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ewHrl1qTsJwglLX/rAoDo7h13fcNoZP0S8uDjbl5ko8='
WHERE
key_id = '87e8833ec747e895c15406b0054db5fe32af9c42f259800ebdb6ec1bb873003b'
AND (
token = 'ewHrl1qTsJwglLX/rAoDo7h13fcNoZP0S8uDjbl5ko8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)