UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9OD3u4X3yg5y14UE7j8gS2hQV3guvJxJCuhpwfBmNr4='
WHERE
key_id = '084b7f50a954b8383690011905a139e499eb11d4c22b88eb7185c4bb680df692'
AND (
token = '9OD3u4X3yg5y14UE7j8gS2hQV3guvJxJCuhpwfBmNr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)