add_unique constrain and index to api_key, add method for generating access_token for api