The codes you are looking for are powertrain codes, so a regular code reader sees them. P1610 to p1615 or so. Here is a link to p1610, which sets after 5 failed attempts to start with a faulty key:
https://www.engine-codes.com/p1610_nissan.html
It includes a procedure to use to get out of a lockout situation. May be helpful if your problem gets worse.
As to shutting off while going down the road, was it just the engine that shut down, or did everything shut off? If it was just the engine - there are two crankshaft sensors on the truck - the second is tucked up under the front pulley.
The camshaft position sensor or the second crank sensor could be failing and not setting a code. Crank sensors are the more common cause of a shutdown with no codes, but a camshaft sensor may do it as well. Crank sensor kills ignition, camshaft sensor kills fuel.
I think the security light issue is first on the list. Maybe carry a code reader with you in case you need to read codes.