Hand 1 AK
Preflop
You should raise bigger over a limp.
Flop
Opponent now donk lead for full pot. If you call this, pot will be around 4k with around 3.3k left in his stack, so less than a pot sized bet. You can either just call and get it in on the turn, or jam now. Raising to any size other than all-in is a mistake, because it commits you to the pot but leave him a silly small amount behind for the turn.
Turn
As played there should not have been any turn action, since you should have jammed the flop. But lets say, you just called the flop. Then you should still jam now, even though flush- and straightdraws got there. He can still pay you off with worse two pair, pair+draw type hands etc.
Result
The hand is just a standard cooler. There is no way to not go broke with TPTK, when the opponent flop a set with around 30BB effective.
Hand 2 AT
Preflop
You only have 14.5BB left now, and the best play is to jam over a limp. You should only min-raise, if there is no action in front of you.
Flop
You flopped a gutshot with two overs, so as played you could continue here. But its a multiway pot, and you are not closing the action, so its ok to get out as well. The chips should have gone in preflop, so you should not even have to make this decision.