Airside, you will be fine. As suggested above, you could pay for access to a lounge.
How long is your layover?
My layover is 5 hours
Which airline are you flying in.out of, and what are the timings?
A lot of people spend their nightly layover airside at Nairobi Airport. Walking the halls of the airport, you'll find dozens of people lying around and sleeping. The lounges aren't open 24 hours, they are closed at night.
JKIA is a very safe airport, and is not easily accessible to random people to no good.
You'll be fine!