It's likely a misattribution or a paraphrase of a similar sentiment. For example, the phrase "Live as if you were to die tomorrow. Learn as if you were to live forever," is sometimes attributed to Mahatma Gandhi. However, the origins of this quote are also debated.
It's always important to verify the source of quotes before accepting them as accurate.