I remember it was a short story. He tries to behave perfectly innocently at all times while planning to carry it out, because the authorities can track his every move, anywhere and any time.
It's at least 20 years ago I read this...
This is probably "Private Eye" by Lewis Padgett.
This review of the story contains a decent plot summary which contains many of the elements you remember.
Kuttner’s prophetic novelette “Private Eye” (1949), in its own sly way, is provocative on several levels, touching on religion, social conformity, sexuality, hypocrisy, criminality, and the not always desirable impact of technology.
In an unspecified but not-too-distant future, the past is an open book and the Eye is always looking over your shoulder:
He had decided that there was only one possible way in which he could kill Vanderman and get away with it. He couldn’t conceal the deed itself or the actions leading up to it, or any written or spoken word. All he could hide were his own thoughts. And, without otherwise betraying himself, he’d have to kill Vanderman so that his act would appear justified, which meant covering his tracks for yesterday as well as for tomorrow and tomorrow. . . . Going off to buy a gun, he felt uncomfortable, as though that prescient Eye, years in the future, could with a wink summon the police. But it was separated from him by a barrier of time that only the natural processes could shorten. And, in fact, it had been watching him since his birth. You could look at it that way . . .
He could defy it. The Eye couldn’t read thoughts. He bought the gun and lay in wait for Vanderman in a dark alley. But first he got thoroughly drunk. Drunk enough to satisfy the Eye.
Kuttner has gone Alfred Bester (The Demolished Man) and George Orwell (Nineteen Eighty-Four) one better. In Bester’s dystopic future, telepathy, while uncommon, is possible but can be thwarted, as can Orwell’s omnipresent telescreens. In Kuttner’s world, nothing anyone has ever experienced is beyond the Eye, presenting a real problem for somebody contem-plating murder and hoping to get away with it.