You didn't say which certificates and ratings you hold, but since you mention 61.31 I assume you're already a certificated pilot in a non-glider category/class (ASEL?) and you're receiving glider training.
The short answer is that a 61.31 solo endorsement expires only if the instructor added an expiration date as a limitation. Including an expiration date is optional, not required; see the Bennett interpretation:
The regulations of 14 C.F.R., however, do not prohibit an instructor
from placing limitations, including an expiration date, in a §
61.31(d) solo endorsement. See 14 CFR § 61.195(d) (prescribing flight instructor limitations on endorsements).
AC 61-65 is the reference for endorsements, and it has this language for a 61.31 solo endorsement (note the "optional" limitations section at the end):
A.71 To act as pilot in command of an aircraft in solo operations when the pilot does not hold an appropriate category/class rating: §
61.31(d)(2).
I certify that [First name, MI, Last name] has received the training
as required by § 61.31(d)(2) to serve as a pilot in command in a
[specific category and class of aircraft]. I have determined that [he
or she] is prepared to solo that [M/M] aircraft. Limitations:
[optional].
Therefore, whether your 61.31 solo endorsement expires or not is determined by the wording of the endorsement itself. But as always, even if your endorsement is valid from the FAA's point of view, the glider school/club and their insurance company may have their own, additional requirements before letting you solo.
I don't understand the second part of your question: "my glider solo endorsement is no longer valid because my power license lapsed". FAA certificates never expire so I have no idea what you mean by "lapsed" (maybe this scenario?). In any case, I suspect that it might be better to ask that as another question; if you do, please tell us exactly which certificates and ratings you have.