Besides updating your connection and team timeout, if you add a non-clustered index to CardID and include the column identifier, Intime, OutTime, which is the coverage index, your query will be faster, which will help.
CREATE NONCLUSTERED INDEX [IX_NCI_MasterLog_CardID] ON [dbo].[MasterLog] ( [CardID] ASC ) INCLUDE ( [ID], [InTime], [OutTime[) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO
source share