Ecclesiastes 7:17:

Be not over much wicked, neither be thou foolish: why shouldest thou die before thy time?

Notes on Ecclesiastes 7:17:

God’s time for you to die is after He has satisfied you with long life.  (See Psalm 91.)  This is not necessarily a specific date and time.  The idea is that you should live a long life, but if you are wicked or foolish, you will live a shorter life, thus dying before your time.  As proved elsewhere in this book, you have far more to do with your lifespan that God does!  You can lengthen or shorten your life in many ways.

See also:

Is There an Appointed Time for Each Person to Die?