1 Peter 3:10-11:

For he that will love life, and see good days, let him refrain his tongue from evil, and his lips that they speak no guile:
Let him eschew evil, and do good; let him seek peace, and ensue it.

See also:

Some of God’s Promises Have Conditions
Is There an Appointed Time for Each Person to Die?