I have no idea if the following sentences are correct:
1)I layed next to the tree for more than an hour.
2)I went to lay down.
3)As I lay there looking at the ceiling a spider walked across my field of view.
4)I lied down in the mud.
First of all, strictly speaking, you have no idea
whether the sentences are correct. "If" is used to introduce the conditional tense, or to express dependency of one outcome upon another: consider your sentence's similarity of structure to "I am lost if the next street isn't Broad Street".
Sometimes stuff like this differs between UK and US English ("gotten" vs "got", for instance), but in UK English, 1 and 4 are incorrect (they should both be "lay") and 2 was once OK but is now hopelessly archaic and unidiomatic (a Brit would use "lie").
You've used two different verbs here: to lie, an intransitive verb (often used with adjective "down"), with past tense "lay", and to lay, a transitive verb, past tense "laid". There's also the other meaning of "to lie" (the untruthfulness one), whose past tense is "lied".
In summary:
"I lie on the floor; I lay on the floor."
"I lay the vine leaves on the rice; I laid the vine leaves on the rice."
"I lie about my age; I lied about my age."
Peter