You can get keys by earning more stars, sending requests to friends, purchasing them with Jewels, or by waiting for a free key.
The time for a free key gets longer as you get to higher levels.
For example, on level 100 you would have to wait 9 hours per key to make a total of 27 hours, but on level 300 you would have to wait 12 hours per key to make a total of 36 hours.
If you do not wish to wait for a free key:
You can earn more stars on the stage that you are on, send requests to friends, or open the lock using Jewels.
Stars can be earned by clearing levels with a certain minimum score.