Ok, did a bit of testing myself.
_time is in epoch including milliseconds, while now() returns a result in seconds. Perhaps that is why you don't find matches.
Just to confirm, can you post an extract of this:
...
| eval x=now()
| eval mytime=_time
| table _time,x,mytime,sum
Looking at that data should tell you why the if statement isn't giving the results you expect.
Update:
As commented below, you might need to round the value of _time, to get rid of the millisecond detail, in order to compare it to now()-x_seconds.
So:
...
| eval x=now()-5
| eval mytime=round(_time)
| eval y=if(mytime=x,sum,null())
... View more