There is no single truth or single meaning to this world, so you are not lying to yourself when you are optimistic or pessimistic. Different perceptions of the world can be given, and all can be correct.
There is some research behind this too: across a two-year study of more than 2,000 people, believing that the world is fundamentally good was statistically associated with living longer. As with any finding like this, it's a link found across a population, not a guarantee for any one person — but it's a small piece of evidence that this way of seeing the world isn't just comforting, it may genuinely be good for you.