Nonlinear optical conductivity of a generic two-band system with application to doped and gapped graphene