Charles Haddon Spurgeon said this quote

Worldlings pray to the Lord in times of need, when it serves their turn. They cry to Him in trouble, but forsake Him in prosperity.