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