According to Google NGrams, "lying in bed" is much more common.
"To lay" is a transitive verb. It can be reflexive - "I lay myself down"myself", "I am laying myself", "I was laying myself" - but it is generally said transitively (requiring a separaterequires an object noun) to indicate something being done.
"To lie" by contrast can beis intransitive. "I lie"It is aan indicator of state, not action. Thus, your statement, which indicates your state in the past perfect, should use this verb and not "lay".
If "I was laying in bed", the connotation is that I was in the act of one's present position; horizontallaying something in that bed, and the sentence is not proper unless that object is either stated explicitly or inferred by context; it can range from the innocent reflexive ("I was laying myself in bed") to the innocent transitive ("I was laying my infant daughter in bed") to the sexual ("I was laying my girlfriend in bed") to the absurd ("I was laying eggs in bed").