I have forgot the joomla admin password, but I had put an invalid email during installation. So I am trying to get the token from db but I cannot locate the table where the token is stored?
If you have access to your database, then look for a table which contains the name users
(can be something like myprefix_users). When you found it, look for your user and click the edit icon next to him.
For your password you can now set the following string:
d2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199
Now your user has the password "secret". Just login immidately and change the password again, as it would be a security risk otherwise.
Note, that this just counts for Joomla versions above 1.5
The token is in the configuration.php; the users table is #__users (and editing you can fix your email address easily).
You can simply follow the official docs for resetting the password, scroll down for J2.5/ 3 code, and change the password as soon as you first login.
The article doesn't mention two factor authentication or strong encryption, should this be the case for you, it's easier to disable the relevant plugins in the #__extensions table.