According to Rule 27-1 from the USGA you have five minutes to search for your ball. This time starts from when you actually start searching for the ball. If you do not find the ball within five minutes the ball is lost whether you find it after the five minutes or not. You must play a ball as close to the spot at which the original ball was played while also incurring a one stroke penalty.
Whenever you hit a shot and you are unsure of whether or not you will be able to find your golf ball, you are allowed to hit a second shot from the same spot. This shot is called a provisional. The purpose of this shot is for in the event that your ball is deemed lost you would not have to go all the way back to the original spot to hit another shot because you already did. If your ball is lost, you would then play the provisional ball to finish out the hole. You would still incur the same penalty as if you had to go back and hit another shot after you lost your ball.
Next time if you are unsure if you can find your ball, hit a provisional just in case. It could save you some valuable time.