Leigh Griffiths scored his 40th goal of the season but it was not enough to stop Celtic losing 2-1 at St Johnstone.