Assuming you change 'lie' to 'lies' in the second variant, both sentences would be correct, but have a slightly different emphasis.
You need to change 'lie' to 'lies' because 'the trap' is third person singular and requires an 's' in present indicative. (If you google: "Lie verb table" you will get lots of hits on the grammatic form. I'm linking to one here).
In the first, the past tense is used consistently. The account is all in the past:
began to see the trap that lay ahead. (From the perspective of the writer both events are in the past. But at the point that he began to see the trap, the trap was in the future; thus 'ahead')
In the second the indication is that at that (past) time he began to see a trap that still or generally lies ahead for most people.
I realise from your comment that you didn't quite understand, so I'll see if I can make it clearer. Imagine I'm writing now as an adult about an event from childhood. I was learning to swim.
I had had three swimming lessons and decided I could swim, but I did
not know about the trap that lay ahead. I swam out into the ocean as
far as I possibly could, but there were strong undercurrents and I
could not swim back. In the end I was rescued by a lifeguard.
(In the example, the trap does not lie ahead from my present day perspective. But it lay ahead before I swam out into the ocean -- thus 'lay'.)
I'm still an adult and writing now about something else from childhood.
I was 4 years old and assumed I would live forever. I did not know
then about the trap (death) that lies ahead for all of us
mortal creatures.
(This 'trap' lies ahead from my present day perpective.)
I hope that helps.