Ginzburg-Landau theory for bosonic gases in optical lattices