As MARamezani points out, had better is used to warn the hearer of some threat, and to suggest a way of avoiding it. The threat may be posed by the speaker or by some external agency. The exact nature of the danger may be expressed with either an if clause or a coordinate clause conjoined with or + a negative or with unless:
You had better unplug the toaster if you don't want a nasty shock.
You had better unplug the toaster, or you may get a nasty shock.
You had better unplug the toaster, unless you want a nasty shock.
But the consequence of not performing the action suggested does not have to be stated explictly; and when the speaker uses the idiom to threaten a hearer it is often left unstated, to allow the hearer to imagine what horrible thing might happen:
You'd better not touch those cookies!
The had better is not in the past tense; as F.E. points out, this past form of the verb signifies 'modal remoteness' ('subjunctive' or 'irrealis' mood) rather than tense. (As explained here, the idiom goes all the way back to Old English, when the language still had subjunctive forms, and originally employed the subjunctive form of BE, not HAVE.)
It's not in the future tense, either: it is a present assessment of a possible future situation, and of a future action you might take in order to dispel that threat.