Update api key logic