Failed to execute the SQL query

select f.id, f.name, count(*) as cnt  from  item  i  inner join  channels  c on c.id = i.cid  inner join  folders  f on f.id = c.parent  where i.unread & 1 and not(i.unread & 8) and not(unread & 4)  and not(c.mode & 8)  group by f.id

Error 1317: Query execution was interrupted