Analysis of self-organized criticality in the Olami-Feder-Christensen model and in real earthquakes