I can't remember if this is the intended behavior or not?
One possibility is that your fob battery is low enough to where the door handle sensors no longer pick up the fob inside the car. Can you try placing the fob in the car but really close to the door handle?
I thought I would try disconnecting the battery to see if it would reset something. I opened the hood and went to find the wrench. I noticed that the door did not lock!! I closed the hood and now it’s working properly. I don’t understand why just opening the hood would reset things but I’m happy that it’s working again. Must be Poltergeists!!
Here comes the naysayer.
We keep our car unlocked whenever we come home, but over the years there's been a handful of times I've gone to the car and found it locked..........HOW? I have at times hit the lock button by accident and have heard the car lock, but unlocked it immediately, but there have also been times I've gotten to the car and it's locked, so just assumed I, or the wife had inadvertently hit the lock button at some point in time, and just never heard the vehicle lock. With FOB inside, I say and have found that the car won't lock with the FOB inside, but as the OP mentioned locking after 30 seconds with the FOB inside, so.....
Leave the FOB inside, exit and close the door, hit the unlock button and low and behold the door locks in about 30 seconds or so, couldn't believe it.
Don't know the OP circumstances whether another FOB was in the area, but at least I know what happens to our car as to the reason it's locked without ever hearing it do so.
Ok granted that I did this test on my 2018 SXL but FWIW the door did not auto-lock no matter how long I left my Smart Remote inside the vehicle with all doors closed and in unlock position; I pressed the lock/unlock button on the driver's side door handle to lock the doors--my car emitted the "You left the fob inside the car" long beep but even after over a minute the doors remained unlocked.
Guess maybe Kia fixed that oversight in later model year/gen Optimas?
Ok maybe I'm misunderstanding the scenario; the only ways one would be pressing the unlock button on the key fob with the fob still inside the vehicle is if either you're inside the vehicle while pressing it or you are outside the vehicle pressing the button using your second key fob (with the first key fob being inside the vehicle). Not sure how one would normally find himself in either scenario in real life, other than to test the door lock with key fob inside theory...
Never hit the FOB inadvertently? I have as well as the wife with it in her pocketbook.
Not debating how competent one might be, but as everyone says the doors cannot lock with a FOB inside, I'm just trying to indicate that the doors can be locked with the FOB inside.
As we never lock the car when parked at the house there's a reason as to why they are locked when we return. It's not often, but more than a couple times over the years, so either one is hitting the lock/unlock button or the car is possessed.
Turbonut--I respect your presence and posts here in this forum; having said that, I do need to point out that locking the door by unknowing/inadvertently pressing the keyfob button is not the same as discovering that the door locked itself. However, I will concede your claim that it is indeed possible to lock the door with a keyfob left inside the vehicle--as noted, the door will not lock if you attempt to lock the door by pressing the door handle button with the fob inside the vehicle, BUT it will lock if you press the lock button on your second/other keyfob.
So yes the door will lock with fob inside but it didn't do so because it somehow magically knew how to eventually lock itself despite the presence of a fob inside the vehicle. Short of a malfunction or other defect--if you somehow managed to lock your car with the fob inside, you're not absolutely screwed since you would have had to have used the other fob to in order to lock the car. Again, the door does not somehow eventually "lock by itself" under such a scenario...
You may have heard of the term "butt dial" (as in, I think I butt-dialed you by mistake)--maybe it may have been a case of "butt lock" with the fob...LOL! Other than that, the only other thing I can think of besides it being a defect/problem is that maybe it's a feature to older-gen Optimas?