I had a very similar problem, loading records from files.
Large numbers of records loaded, to be converted to accounts. A particular "card number" had an expiration date (timestamp), there were two other identifiers involved, call them sid and eid, and a primary key.
SELECT
i.record_id...