When “then” means “at that time,” it does not take a comma as it is an adverb.
...He was then on his way to becoming successful.
...I saw them and then began to wonder what would happen.
If "then" is at the beginning of a sentence, it starts a new sentence and needs a semicolon or a period in front of it. If “and” is in front of it, the "and" is irrelevant and does not affect the punctuation.
…He walked into the house; then he began to shake.
…He walked into the house, and then he began to shake.
…And then I noticed the bug.
When “then” doesn’t have any meaning but is just a “throwaway” type word, it takes commas around it.
…Well, then, are you intending to leave that here?
…Are you saying, then, that you need this here?
Happy punctuating!
Margie